package com.xy.job.admin.controller

import com.xy.job.admin.core.AdminServiceBiz
import com.xy.job.core.api.request.HeartbeatParam
import com.xy.job.core.api.request.JobFeedbackParam
import com.xy.job.core.api.response.wrapperResponse
import io.swagger.v3.oas.annotations.Hidden
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@Hidden
@RestController
@RequestMapping("/private/api/admin")
class AdminController(
    var adminServiceBiz: AdminServiceBiz
) {

    @PostMapping("/heartbeat")
    fun heartbeat(@RequestBody param: HeartbeatParam) = wrapperResponse {
        adminServiceBiz.heartbeat(param)
        return@wrapperResponse true
    }

    @PostMapping("/feedback")
    fun feedback(@RequestBody param: JobFeedbackParam) = wrapperResponse {
        adminServiceBiz.feedback(param)
        return@wrapperResponse true
    }
}